package com.cai.baselibrary.mvp.presenter

import android.content.Intent
import android.os.Bundle
import com.cai.baselibrary.mvp.IView
import java.lang.ref.SoftReference

 open class IPresenter<T : IView> constructor(v: T){
     var mView: SoftReference<T> = SoftReference(v)

    /**只在Activity中使用*/
    open fun onCreate(intent: Intent?) {
        mView.get()?.init()
    }

    /**只在Fragment中使用*/
    open fun onCreateView(arguments: Bundle?) {
        mView.get()?.init()
    }

    open fun onStart() {}
    open fun onResume() {}
    open fun onPause() {}
    open fun onStop() {}
    open fun onDestroy() {
        mView.clear()
    }



}